package tools

import (
	"github.com/gin-gonic/gin"
	"ruoyi-go/app/admin/api/tools"
	"ruoyi-go/utils"
)

func InitGen(e *gin.Engine) {
	// 路由权限相关
	v := e.Group("tool/gen")
	{
		auth := v.Group("")
		auth.Use(utils.JWTAuthMiddleware())
		{
			// 需要权限
			auth.GET("list", tools.GetListHandler)
			auth.GET(":tableId", tools.GetGenById)
			auth.GET("db/list", tools.GetDBListHandler)
			auth.GET("column/:tableId", tools.GetColumnGen)
			auth.POST("importTable", tools.ImportTableHandler)
			auth.PUT("", tools.UpDataGen) //修改保存代码生成业务
			auth.DELETE(":tableIds", tools.DelectGenTable)
			auth.GET("preview/:tableId", tools.PreviewGen)
			auth.GET("download/:tableName", tools.DownloadGen)
			auth.GET("genCode/:tableName", tools.GetGenCode)
			auth.GET("synchDb/:tableName", tools.GetsynchDb)
			auth.GET("batchGenCode", tools.GetBatchGenCode)
		}
	}
}
